package lianxi;

public class _07_ {

	public static void main(String[] args) {
		System.out.println(fbnq(999));
	}

	public static int fbnq(int n) {
		int[] arr = new int[100];
		int m = -1;
		// 存放斐波那契数列元素
		for (int i = 0; i < arr.length; i++) {
			if (i == 0 || i == 1) {
				arr[i] = 1;
			} else {
				arr[i] = arr[i - 1] + arr[i - 2];
			}
		}
		// 遍历获取下标位置
		for (int i = 0; i < arr.length ; i++) {
			if (n == arr[i]) {
				m = i;
			}
		}
		return m;
	}
}
